package com.mfp.java.testYou.db;

import java.sql.SQLException;
import java.util.List;

import com.mfp.java.testYou.db.model.CompletedTest;
import com.mfp.java.testYou.db.model.Question;
import com.mfp.java.testYou.db.model.Test;
import com.mfp.java.testYou.db.model.User;

public interface DataAccessObject {

	public List<User> getAllUsers();

	public User getUser(String username, CharSequence password) throws UnauthorizedException;

	public User getUser(Integer userId) throws IllegalArgumentException;

	public User addUser(User user, CharSequence pass) throws SQLException, IllegalArgumentException;

	public void deleteUser(Integer userId) throws SQLException, IllegalArgumentException;

	/**
	 * 
	 * @param newUserData
	 *            all data of the user (role, lang)
	 * @param pass
	 *            null if pass should not be changed
	 * @param userId
	 *            db id of user
	 * @return
	 * @throws SQLException
	 * @throws IllegalArgumentException
	 */
	public User editUser(User newUserData, CharSequence pass, int userId) throws SQLException, IllegalArgumentException;

	public List<Question> getAllQuestions();

	public Question getQuestion(Integer id) throws IllegalArgumentException;

	public Question addQuestion(Question q) throws SQLException, IllegalArgumentException;

	public void deleteQuestion(Integer questionIdInt) throws SQLException, IllegalArgumentException;

	public Question editQuestion(Question question, Integer qIdInt) throws SQLException, IllegalArgumentException;

	public List<Test> getAllTests();

	public List<Test> getFinalTests();

	public Test getTest(Integer testIdInt) throws IllegalArgumentException;

	public Test addTest(Test t) throws SQLException, IllegalArgumentException;

	public void deleteTest(Integer testIdInt) throws SQLException, IllegalArgumentException;

	public Test editTest(Test test, Integer testIdInt) throws SQLException, IllegalArgumentException;

	public void addQuestionToTest(Integer testId, Integer questionId) throws SQLException, IllegalArgumentException;

	public void deleteQuestionFromTest(Integer testId, Integer questionId) throws SQLException, IllegalArgumentException;

	public void addCompletedTest(CompletedTest ct) throws SQLException;

	public List<CompletedTest> getAllCompletedTests();
}
